package com.shicijiaoliu.conifig;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class webconifig implements WebMvcConfigurer {

    @Autowired
    private com.shicijiaoliu.interceptors.logininterceptor logininterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        //登录和注册不拦截
        registry.addInterceptor(logininterceptor).excludePathPatterns("/user/login","/user/register","/home","/captcha/generate","/user/sendemail/{email}","/user/findpwd"); //注册拦截器
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/api/file/**").addResourceLocations("file:" + "D:/item/biyesheji/shici/shicivue/src/images");
    }
}
